package cn.circle.system.service.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import cn.circle.commom.model.DataGrid;
import cn.circle.commom.model.PageHelper;
import cn.circle.system.dao.ISysCustomerDao;
import cn.circle.system.model.SysCustomer;
import cn.circle.system.service.ISysCustomerService;

@Repository
public class SysCustomerService implements ISysCustomerService{

	@Autowired
	public ISysCustomerDao sysCustomerDao;
	
	DataGrid dg = new DataGrid();
	
	@Override
	public DataGrid datagrid() {
		// TODO Auto-generated method stub
		
		List<SysCustomer> l = sysCustomerDao.datagrid();
		dg.setRows(l);
		dg.setTotal((long)l.size());
		return dg;
	}

	@Override
	public List<SysCustomer> getUser(String id) {
		// TODO Auto-generated method stub
		return sysCustomerDao.getUser(id);
	}
	@Override
	public boolean save(SysCustomer sysCustomer) {
	//	SessionFactory sessionFactory 
		sysCustomerDao.save(sysCustomer);
		return true;
	}
	@Override
	public boolean deleteAll(String ids) {
		sysCustomerDao.deleteAll(ids);
		return false;
	}
	@Override
	public boolean update(SysCustomer c) {
		// TODO Auto-generated method stub
		sysCustomerDao.updataAll(c);
		return true;
	}

}
